//
//  Singleton.m
//  UI11_Elevn_plus
//
//  Created by 侯振兴 on 14/12/11.
//  Copyright (c) 2014年 侯振兴. All rights reserved.
//

#import "Singleton.h"

static Singleton *share = nil;

@implementation Singleton

- (void)dealloc
{
    [super dealloc];
    
}

+ (instancetype)shareInstance
{
    //第一种单例安全
    @synchronized(self){
    if (!share) {
        share = [[Singleton alloc] init];
        }
    }
    return share;
    
    
    
    //第二种单例安全
//    static dispatch_once_t once;
//    dispatch_once(&once, ^{
//        if (!share) {
//            share = [[Singleton alloc] init];
//        }
//    });
//    return share;
//
    
}


- (instancetype)init
{
    self = [super init];
    if (self) {
        self.settingController = [[SettingsViewController alloc] init];
        self.readingController = [[ReadingRoomViewController alloc] init];
        self.searchCotroller = [[SearchViewController alloc] init];
        self.holdController = [[HoldingViewController alloc] init];
        self.homeController = [[HomePageViewController alloc] init];
        self.classController = [[ClassificationController alloc] init];
    }
    return self;
}


@end
